package design_pattern.proxy.staticProxy;

/**
 * @version 1.0.0
 * Created by cyd on 2024-07-27 13:49:56
 * @ClassName : design_pattern.proxy.staticProxy.Client
 * @Description : 类描述
 */
public class Client {

    void buyDirectly(String size) {
        AProductFactory AProductFactory = new AProductFactory();
        AProductFactory.saleSomething(size);
    }

    void buyFormProxy(String size) {

        ProductSaleProxy aFactory = new AProductFactory();
        ProductSaleProxy proxy = new ProductStaticRealProxy(aFactory);
        // 张三调用lison代理的工厂方法
        proxy.saleSomething(size);
    }


    void buyFormProxyToAnotherFactory(String d) {

        ProductSaleProxy bFactory = new BProductFactory();
        // 让lison代理工厂
        ProductSaleProxy proxy = new ProductStaticRealProxy(bFactory);
        // 张三调用lison代理的工厂方法
        proxy.saleSomething(d);
    }
}
